package com.proton.carepatchtemp.fragment;


import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.proton.carepatchtemp.R;
import com.proton.carepatchtemp.base.BaseFragment;
import com.proton.carepatchtemp.ui.CenterTextView;
import com.proton.carepatchtemp.utils.eventbus.MainEvent;

public class UseDirection2Fragment extends BaseFragment {
    private CenterTextView mTvUseDirection3;


    public UseDirection2Fragment() {
    }

    public static UseDirection2Fragment newInstance() {
        return new UseDirection2Fragment();
    }

    @Override
    public void dealEvent(MainEvent event) {

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fragment_use_direction2, container, false);
        initView(v);

        String html = "3、轻按" + "“" + "<img src='" + R.drawable.use_direction_onoff + "'/>" + "”，" + "蓝色指示灯闪烁表明体温贴开始工作";
        Html.ImageGetter imgGetter = source -> {
            int id = Integer.parseInt(source);
            Drawable d = getResources().getDrawable(id);
            d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
            return d;
        };
        CharSequence charSequence = Html.fromHtml(html, imgGetter, null);
        mTvUseDirection3.setText(charSequence);
        return v;
    }

    @Override
    public void onEventMainThread(MainEvent event) {

    }

    private void initView(View v) {
        mTvUseDirection3 = v.findViewById(R.id.tv_use_direction3);
    }
}
